using System.Threading.Tasks;
using AnimationPage.Views;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;

namespace AnimationPage.ViewModels;

public partial class RegisterPageViewModel : ViewModelBase
{
    [ObservableProperty] private string? _username;
    [ObservableProperty] private string? _email;
    [ObservableProperty] private string? _password;

    [RelayCommand]
    private void OnLogin()
    {
        App.GoPage(new LoginPage()
        {
            DataContext = new LoginPageViewModel()
        });
    }

    [RelayCommand]
    private async Task OnRegisterAsync()
    {
        await RunCommandAsync(() => IsBusy, async () => { await Task.Delay(5000); });
    }
}